Skip to content

Marcorensch#29

Open
marcorensch wants to merge 5 commits intoibwgr:masterfrom
marcorensch:marcorensch
Open

Marcorensch#29
marcorensch wants to merge 5 commits intoibwgr:masterfrom
marcorensch:marcorensch

Conversation

@marcorensch
Copy link

Einfach mal alles mocken bei withValidInexitingUsername_addUserToDB__MOCKITO

getAgeReturns10YearsIf10ago
getAgeHasToBePositive
checkIfAgeIsLargerThen11
Updated Tests:
getAgeReturns1DayIfYesterday
getAgeReturns5MonthsIf5MonthsAgo
Included meine UserVsalidatorTest Lösungen
Changed UserValidator.isValidUsername
Included meine UserVsalidatorTest Lösungen
Changed UserValidator.isValidUsername
// TODO

UserValidator uv = mock(UserValidator.class);
doReturn(true).when(uv).doesUsernameExist(anyString());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

InexistingUsername steht im Testnamen :)
Zudem ist die SUT ja der UserController nicht der UserValidator.


String username = "2OnlyLetters";

UserValidator uv = new FakeUserValidator();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Die SUT sollte nie ein Fake sein. Du möchtest ja die echte UserValidator Klasse testen.

}
}

static class doesUsernameExist{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alle Tests sollten die Methode UserValidator.doesUsernameExist aufrufen und dessen Ergebnis prüfen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants